//
//  DoorStatusModel.m
//  RONGAO
//
//  Created by ZhangYeKun on 2017/3/19.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "DoorStatusModel.h"
#import "RongGaoGit.h"
@implementation DoorStatusModel


- (void)functionCode:(NSString *)functionCode dataCode:(NSString *)dataCode{
    NSInteger index = [[self functionCodes]indexOfObject:functionCode];
    if (index > [self functionCodes].count) {
        return;
    }
    [self setPropertyWithName:[self propertyOfSelf][index] object:dataCode];
    [RongGaoGit saveDoorStatusModel:self];
    for (; index<[self functionCodes].count; index++) {
        
       NSString *data = [self sendGetMethodWithPropertyName:[self propertyOfSelf][index]];
        if ([data length] == 0) {
            
                [[AppDelegate globalDelegate] sendCommandByFunctionCode:[self sendCodes][index] functionCommand:@"0301"];
           
            break;
        }
    }
    
}

- (NSArray *)sendCodes{
    
    return @[@"1001",@"1002",@"1003",@"1004",@"1005",@"1006",@"1007",@"1008",@"1009",@"100A",@"100C",@"100D",@"100E",@"1012",@"1000",@"1015",@"1013"];
    
}

- (NSArray *)functionCodes{
    return @[@"1801",@"1802",@"1803",@"1804",@"1805",@"1806",@"1807",@"1808",@"1809",@"180A",@"180C",@"180D",@"180E",@"1812",@"1800",@"1815",@"1813"];
}


@end
